﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BLL;

public partial class MasterPage : System.Web.UI.MasterPage
{
    NhomSanPhamBO bll;
    protected void Page_Load(object sender, EventArgs e)
    {
        bll = new NhomSanPhamBO();
        Load_ParentProduct();


        //var bang = (Gio_Hang)Session["giohang"];
        //fbt_giohang.Text = " Giỏ hàng (" + bang.Rows.Count + ")";

    }
    protected void Load_ParentProduct()
    {
        rptnhomcha1.DataSource = bll.Laynhomsanphamcha();
        rptnhomcha1.DataBind();
    }
    protected void rptnhomcha1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        HiddenField hrId = (HiddenField)e.Item.FindControl("hrID1");
        Repeater rpChildrent = (Repeater)e.Item.FindControl("rptnhomcha2");
        if ((hrId != null) && (rpChildrent != null))
        {
            int ma = Convert.ToInt32(hrId.Value);
            rpChildrent.DataSource = bll.Laynhomsanphamcon(ma);
            rpChildrent.DataBind();
        }
    }

    protected void rptnhomcha2_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        HiddenField hrId = (HiddenField)e.Item.FindControl("hrID2");
        Repeater rpChildrent = (Repeater)e.Item.FindControl("rptnhomcha3");
        if ((hrId != null) && (rpChildrent != null))
        {
            int ma = Convert.ToInt32(hrId.Value);
            rpChildrent.DataSource = bll.Laynhomsanphamcon(ma);
            rpChildrent.DataBind();
        }
    }
    protected void bt_giohang_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Default2.aspx");
    }
}
